package com.vlin.device.value.converter;

import com.vlin.entity.mode.DeviceMode;

public abstract class AbstractParamValueConverter implements ParamValueConverter {

	private DeviceMode deviceMode;
	


	@Override
	public Object valueConvert(String category, String key, String value) {
		
		Condition condition = getConditionManager().getCondition(category, key);
		return getConditionAndConverter().handleAndConvert(value, condition);

	}

	@Override
	public Object valueConvert(String key, String value) {
		
		Condition condition = getConditionManager().getCondition(key);
		return getConditionAndConverter().handleAndConvert(value, condition);
	}


	@Override
	public void setDeviceMode(DeviceMode deviceMode) {
		this.deviceMode = deviceMode;

	}

	@Override
	public void setConverter(String category, String key, Condition condition) {
		getConditionManager().setConverter(category, key, condition);
	}

	@Override
	public Condition getCondition(String category, String key) {
		
		return getConditionManager().getCondition(category, key);
	}

	@Override
	public Condition getCondition(String key) {
		
		return getConditionManager().getCondition(key);
	}

	@Override
	public DeviceMode getDeviceMode() {

		return this.deviceMode;
	}



}
